package demo;

public class Text {
    public static void func(int[] arr) throws Exception {
        if(arr==null){
            throw new Exception("array异常"+arr);
        }
    }

    public static void main(String[] args) {
        try {
            System.out.println(10/ 0);
        }
        catch (ArithmeticException e){
            System.out.println("算数异常");
            e.printStackTrace();
        }
        catch (Exception e){
            System.out.println("Exception异常");

        }finally {
            System.out.println("释放资源");
        }
        System.out.println("完成后续代码");


    }
    public static void main2(String[] args) {
        try {
            int [] array=null;
            System.out.println(array.length);
            System.out.println("array");
        }catch (Exception e){
            System.out.println("捕获到了这个异常,并处理");
            e.printStackTrace();
        }
        System.out.println("处理完了");
    }
    public static void main1(String[] args)  {
        try {
            int [] array=null;
            func(array);
        }catch (Exception e){
            System.out.println("捕获到了这个异常,并处理");
            e.printStackTrace();
        }
        System.out.println("处理完了");
    }
}
